package com.urbane.generator.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@Data
@Validated
public class GenConfigDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    // 数据库配置
    @NotBlank(message = "数据库URL不能为空")
    private String dbUrl;
    private String dbUsername;
    private String dbPassword;
    private String driverClassName = "com.mysql.cj.jdbc.Driver";

    // globalConfig 全局配置
    private String author = "龙茶清欢";
    private boolean springdocEnabled = true;

    // packageConfig 包配置
    private String parentPackage = "com.example";   // 父包名
    private String moduleName = "demo";     // 模块名
    private String entityPackage = "entity";    // 实体包名
    private String controllerPackage = "controller";    // 控制层包名
    private String servicePackage = "service";  // 服务层包名
    private String serviceImplPackage = "service.impl"; // 服务层实现包名
    private String mapperPackage = "mapper";    // 持久层包名
    private String xmlPackage = "mapper";   // 持久层XML文件包名
    
    // strategyConfig 生成策略
    @Size(min = 1, message = "至少选择一个表")
    private List<String> tables;       // 要生成的表名列表

    private String tablePrefix = "";   // 表前缀过滤
    private boolean lombokEnabled = true;
    
    // injectionConfig 自定义模板路径和输出位置，从而生成与后端代码对应的前端 Vue 和 TypeScript 数据表格代码
    private String outputDir = "/tmp/gencode"; // 临时生成目录
}